home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 October / Macformat17.cdr / Shareware City / Developers / GAL ƒ / GAL examples / average < prev    next >
Encoding:
Text File  |  1994-07-11  |  388 b   |  17 lines  |  [TEXT/ttxt]

  1. ; finds the average of  the 10 numbers declared as constants
  2.  
  3.     copy        #0=>reg1           
  4.     load_address    a=>r0        
  5. loop    add          (r0)=>reg1
  6.     add          #2=>reg0
  7.     compare  @a+18=>reg0            ; limit = addr(a)+9*2
  8.     jump:greater_equal    loop
  9. continue
  10.     copy        #10=>reg2
  11.     divide    reg2=>reg1          ; r2 := c(r1) / 10
  12.     copy        reg1=>av
  13.     halt
  14. a    constant   3,52,-7,40,5,-31,8,36,6,9 
  15. av    variable   1
  16.         end
  17.